package com.mvu.banana.domain.server;

import javax.persistence.EntityManager;

/**
 */
public abstract class BlockRunner {

  public abstract void run(EntityManager em);

  public void run() {
    EntityManager em = EMF.get().createEntityManager();
    try {
      em.getTransaction().begin();
      run(em);
      em.getTransaction().commit();
    } finally {
      em.close();
    }
  }
}
